Literate sample
This file demonstrates how to write Markdown document with
embedded F# snippets that can be transformed into nice HTML
using the literate.fsx script from the F# Formatting
package.
In this case, the document itself is a valid Markdown and you can use standard Markdown features to format the text:
- Here is an example of unordered list and...
- Text formatting including bold and emphasis
For more information, see the Markdown reference.
Writing F# code
In standard Markdown, you can include code snippets by
writing a block indented by four spaces and the code
snippet will be turned into a <pre> element. If you do
the same using Literate F# tool, the code is turned into
a nicely formatted F# snippet:
1: 2: 3: 4: 5: 6: |
|
Hiding code
If you want to include some code in the source code,
but omit it from the output, you can use the hide
command. You can also use module=... to specify that
the snippet should be placed in a separate module
(e.g. to avoid duplicate definitions).
The value will be deffined in the F# code that is processed and so you can use it from other (visible) code and get correct tool tips:
1:
|
|
Including other snippets
When writing literate programs as Markdown documents, you can also include snippets in other languages. These will not be colorized and processed as F# code samples:
1:
|
|
This snippet is turned into a pre element with the
lang attribute set to csharp.
Markdown extensions
===================
To use LaTex extension, you need add javascript link to MathJax in your template.
To use inline LaTex, eclose LaTex code with $:
\(k_{n+1} = n^2 + k_n^2 - k_{n-1}\). Alternatively,
you can also use $$.
To use block LaTex, start a new parapgraph, with
the first line marked as $$$ (no close $$$):
\[A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix}\]
Use LaTex escape rule:
- Escape $ in inline mode: \(\$\), \(\$var\)
- Other escapes: \(\& \% \$ \# \_ \{ \}\)
- Using < or >: \(x > 1\), \(y < 1\), \(x >= 1\), \(y <= 1\), \(x = 1\)
Full name: demo.factorial
The Hello World of functional languages!
Full name: demo.f10
Full name: demo.answer
from demo
Full name: demo.Hidden.answer
This is a hidden answer